var e = require;
var t = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("NotifyEventType"),
    a = e("AssetsManager"),
    i = e("ModuleUI"),
    r = e("EquipInfo"),
    s = e("equip_item_info"),
    l = cc._decorator,
    c = l.ccclass,
    d = l.property,
    h = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.equip_item = null),
                (t.equip_view = null),
                (t.btn_view = null),
                (t.equip_name_label = null),
                (t.equip_icon_sprite = null),
                (t.int_info_node = null),
                (t.equip_skill_list = []),
                (t.equip_type = ["att", "hp", "speed", "cool"]),
                t
            );
        }
        return (
            __extends(t, e),

            (t.prototype.onDisable = function () {

                Adv_skd.default.instance.hideBannerAd();
                Adv_skd.default.instance.hideGridAdLeft();
                Adv_skd.default.instance.hideGridAdRight();
                Adv_skd.default.instance.hideGridAdTop();
                Adv_skd.default.instance.hideGridAdLeftOne();
                Adv_skd.default.instance.hideGridAdRightOne();
                Adv_skd.default.instance.hideGridAdButtom();

            }),

            (t.prototype.initView = function () {

                Adv_skd.default.instance.hideBannerAd();
                Adv_skd.default.instance.hideGridAdLeft();
                Adv_skd.default.instance.hideGridAdRight();
                Adv_skd.default.instance.hideGridAdTop();
                Adv_skd.default.instance.hideGridAdLeftOne();
                Adv_skd.default.instance.hideGridAdRightOne();
                Adv_skd.default.instance.hideGridAdButtom();
                Adv_skd.default.instance.showGridAdLeftOne();
                Adv_skd.default.instance.showGridAdRightOne();
                Adv_skd.default.instance.showInterstitialAd();

                e.prototype.initView.call(this);
                for (var t = 0; t < 3; t++)
                    for (var o = 0; o < 4; o++) cc.instantiate(this.equip_item).setParent(this.equip_view.children[t]);
                this.attachEvent(n.default.SEND_CHOOSE_EQUIP_INFO, this.showChooseEquipInfo, this),
                    this.showEquipViewInfo("att");
            }),
            (t.prototype.OnClick = function (t) {
                switch ((e.prototype.OnClick.call(this, t), t.node.name)) {
                    case "back_btn":
                        this.emitEvent(n.default.SEND_BOX_PORTAL_INFO, !0), this.node.destroy();
                        break;
                    case "equip_att_btn":
                        this.showEquipViewInfo("att");
                        break;
                    case "equip_hp_btn":
                        this.showEquipViewInfo("hp");
                        break;
                    case "equip_speed_btn":
                        this.showEquipViewInfo("speed");
                        break;
                    case "equip_cooling_btn":
                        this.showEquipViewInfo("cool");
                }
            }),
            (t.prototype.showEquipViewInfo = function (e) {
                for (var t = 0; t < 4; t++)
                    (this.btn_view.children[t].children[0].active = e != this.equip_type[t]),
                        (this.btn_view.children[t].children[1].active = e == this.equip_type[t]);
                var o = [];
                for (
                    "att" == e
                        ? (o = r.default.equip_att_info)
                        : "hp" == e
                        ? (o = r.default.equip_hp_info)
                        : "speed" == e
                        ? (o = r.default.equip_speed_info)
                        : "cool" == e && (o = r.default.equip_cooling_info),
                        t = 0;
                    t < 3;
                    t++
                )
                    for (var a = 0; a < 4; a++) this.equip_view.children[t].children[a].active = !1;
                for (t = 0; t < o.length; t++) {
                    var i = r.default.eqquip_info[o[t]],
                        l = this.equip_view.children[i.eq_level - 1].children[i.eq_index];
                    l.getComponent(s.default).showEquipInfo(i), (l.active = !0);
                }
                this.emitEvent(n.default.SEND_CHOOSE_EQUIP_INFO, {use: !1, info: r.default.eqquip_info[o[0]]});
            }),
            (t.prototype.showChooseEquipInfo = function (e, t) {
                var o = t.info;
                (this.equip_name_label.string = "" + o.eq_name),
                    (this.equip_icon_sprite.spriteFrame = a.default
                        .getInstance()
                        .getEquipIconFrame("equip_" + o.eq_ID));
                for (var n = 0; n < this.equip_skill_list.length; n++)
                    (this.equip_skill_list[n].active = o.eq_skill[n]),
                        this.equip_skill_list[n].active &&
                            ((this.equip_skill_list[n].getChildByName("type").getComponent(cc.Label).string =
                                o.eq_skill[n]),
                            (this.equip_skill_list[n].getChildByName("info").getComponent(cc.Label).string =
                                o.eq_skill_des[n]));
                for (n = 0; n < 2; n++)
                    (this.int_info_node.children[n].active = o.eq_int[n]),
                        this.int_info_node.children[n] &&
                            (this.int_info_node.children[n].children[0].getComponent(cc.Label).string = o.eq_int[n]);
            }),
            __decorate([d(cc.Node)], t.prototype, "equip_item", void 0),
            __decorate([d(cc.Node)], t.prototype, "equip_view", void 0),
            __decorate([d(cc.Node)], t.prototype, "btn_view", void 0),
            __decorate([d(cc.Label)], t.prototype, "equip_name_label", void 0),
            __decorate([d(cc.Sprite)], t.prototype, "equip_icon_sprite", void 0),
            __decorate([d(cc.Node)], t.prototype, "int_info_node", void 0),
            __decorate([d(cc.Node)], t.prototype, "equip_skill_list", void 0),
            __decorate([c], t)
        );
    })(i.default);
o.default = h;
